#include "at89x52.h"
#define RCLK   P1_5   
#define SDATA  P1_6   
#define SCLK   P1_7   
unsigned char lie[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
unsigned char hang[8]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
unsigned char dao[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char jiantou[6]={0x08,0x1c,0x2a,0x08,0x08,0x08};
unsigned char tao[6]={0x7c,0x52,0x25,0x25,0x52,0x7c};
unsigned char S[4]={0x7a,0x49,0x49,0x2e};
unsigned char Z[4]={0x7e,0x49,0x49,0x3e};
unsigned char jiong[6]={0x7f,0x51,0x67,0x67,0x51,0x7f};
void delay()
{
 int a,b;
 {
   for(a=1000;a>0;a--)
   {
    for(b=2000;b>0;b--)
    {
    }
   }
 }
}
void SendData(unsigned char Xdata, unsigned char Ydata)
{
  unsigned char i=0;
  RCLK=0;
  for (i=0;i<8;i++)
  {
      SDATA=Xdata & 0x01;
      SCLK = 0;
	  SCLK = 1;
      
      Xdata=Xdata>>1;
  }
  for (i=0;i<8;i++)
  {
      SDATA=Ydata & 0x01;
     SCLK = 0; 
	 SCLK = 1;
      
      Ydata=Ydata>>1;
  }     
  RCLK=1;
}
void main(void)
{

    while(1)
  {
   int i,k,j,n;
   for(k=8;k>=0;k--)
   {
   for(n=300;n>0;n--)
   {
   for(i=0;i<6;i++)
   {
    j=k+i;
	if(j>7)
	{
	j=j%8;
	}
    SendData(hang[j],jiantou[i]);
   }
   }
   }


   for(k=8;k>=0;k--)
   {
   for(n=300;n>0;n--)
   {
   for(i=1;i<7;i++)
   {
    j=k+i;
	if(j>7)
	{
	j=j%8;
	}
    SendData(hang[j],tao[i-1]);
   }
   }  
   }
  
   for(k=8;k>=0;k--)
   {
   for(n=300;n>0;n--)
   {
   for(i=2;i<6;i++)
   {
    j=k+i;
	if(j>7)
	{
	j=j%8;
	}
    SendData(hang[j],S[i-2]);
   }
   }  
   }
  

   for(k=8;k>=0;k--)
   {
   for(n=300;n>0;n--)
   {
   for(i=2;i<6;i++)
   {
    j=k+i;
	if(j>7)
	{
	j=j%8;
	}
    SendData(hang[j],Z[i-2]);
   }
   }  
   }
  
  for(k=8;k>=0;k--)
   {
   for(n=300;n>0;n--)
   {
   for(i=1;i<7;i++)
   {
    j=k+i;
	if(j>7)
	{
	j=j%8;
	}
    SendData(hang[j],jiong[i-1]);
   }
   }   
   }  
   
 

 }
}